package org.pageley.games.sanctuary.domain.entity.creature;

public class SimpleProfile implements CreatureProfile {

	private int perception;
	private int intelligence;
	private int agility;
	private int endurance;
	private Race race;
	
	public int getPerception() {
		return perception;
	}

	public void setPerception(int perception) {
		this.perception = perception;
	}

	public int getIntelligence() {
		return intelligence;
	}

	public void setIntelligence(int intelligence) {
		this.intelligence = intelligence;
	}

	public int getAgility() {
		return agility;
	}

	public void setAgility(int agility) {
		this.agility = agility;
	}

	public int getEndurance() {
		return endurance;
	}

	public void setEndurance(int endurance) {
		this.endurance = endurance;
	}

	public void setRace(Race race) {
		this.race = race;
	}

	public static class Builder {
		private int perception;
		private int intelligence;
		private int agility;
		private int endurance;
		private Race race;
		
		public Builder perception(int perception) {
			this.perception = perception;
			return this;
		}
		
		public Builder intelligence(int intelligence) {
			this.intelligence = intelligence;
			return this;
		}
		
		public Builder agility(int agility) {
			this.agility = agility;
			return this;
		}
		
		public Builder endurance(int endurance) {
			this.endurance = endurance;
			return this;
		}
		
		public Builder race(Race race) {
			this.race = race;
			return this;
		}
		
		public CreatureProfile build() {
			SimpleProfile profile = new SimpleProfile();
			profile.race = race;
			profile.agility = agility;
			profile.intelligence = intelligence;
			profile.perception = perception;
			profile.endurance = endurance;
			return profile;
		}
	}

	@Override
	public int getActionPoints() {
		return this.agility + 1;
	}

	@Override
	public Race getRace() {
		return race;
	}

	@Override
	public int getWeaponSkill() {
		return (perception + agility + intelligence) / 3;
	}

	@Override
	public int getHitPoints() {
		return 16 + 3 * endurance;
	}

}
